/*******获取轮播图片******/
$.ajax({
	type: "get",
	url: "/slide_img/list",
	dataType: "json",
	async: false,
	success: function(data) {
		var str = "";
		for(var key in data){
			if(data[key].y_n == 1)
				str += template("tpl_carousel", data[key])
		}
		$("#carousel").empty().append(str);
	}
})


/********导入layui轮播模块**********/
layui.use('carousel', function() {
	var carousel = layui.carousel;
	//建造实例
	carousel.render({
		elem: '#test1',
		width: '100%', //设置容器宽度
		height: "30rem",
		arrow: 'hover', //始终显示箭头,
		interval: 2000 //轮播速度
		//,anim: 'updown' //切换动画方式
	});
});

/* sale部分动态调取数据 */
$(function() {
	$.ajax({
		type: "get",
		url: "/index_img/list",
		dataType: "json",
		async: false,
		success: function(data) {
			var str1 = ""
			var str2 = ""
			var str3 = ""
			for (var inimg in data) {
				if (data[inimg].inclass == 1) {
					str1 += template("tpl_sale", data[inimg])
				} else if (data[inimg].inclass == 2) {
					str2 += template("tpl_sale", data[inimg])
				} else {
					str3 += template("tpl_sale", data[inimg])
				}
			}
			$("#sale1").empty().append(str1)
			$("#sale2").empty().append(str2)
			$("#sale3").empty().append(str3)
		}
	})
})

/* 球队logo动态调取 */
$(function() {
	$.ajax({
		type: "get",
		url: "/team_list/list",
		dataType: "json",
		async: false,
		success: function(data) {
			var str1 = `<a href="#"><img src="./img/team/east.png"/></a>`
			var str2 = `<a href="#"><img src="./img/team/west.png"/></a>`
			for (var tlogo in data) {
				if (data[tlogo].tid <= 15) {
					str1 += template("tpl_team", data[tlogo])
				} else {
					str2 += template("tpl_team", data[tlogo])
				}
			}
			$("#east").empty().append(str1)
			$("#west").empty().append(str2)
		}
	})
})
